package com.wasion.pwportable.domain.po;

import java.util.Comparator;

import com.wasion.core.db.orm.annotation.ActionType;
import com.wasion.core.db.orm.annotation.Column;
import com.wasion.core.db.orm.annotation.Relations;
import com.wasion.core.db.orm.annotation.RelationsType;
import com.wasion.core.db.orm.annotation.Table;

/**
 * 
 * @ClassName: IndicatorStatus
 * @Description: 指示器状态
 * @author 高意
 * @date 2014-10-10 下午3:27:21
 * 
 */
@Table(name = "indicator_status")
public class IndicatorStatus {

	// 指示器id
	@Column(name = "_id")
	private int indicatorid;

	// 终端Id
	@Column(name = "terminalid")
	private String terminalid;

	// 指示器
	@Relations(name = "indicator", foreignKey = "_id", type = RelationsType.one2one, action = ActionType.query)
	private Indicator indicator;

	// 单点通信状态
	@Column(name = "singlecomm")
	private int singlecomm;

	// 多级通信状态
	@Column(name = "multicomm")
	private int multicomm;

	// 组网状态
	@Column(name = "network")
	private int network;

	// 最后操作时间
	@Column(name = "time")
	private String time;

	public int getIndicatorid() {
		return indicatorid;
	}

	public void setIndicatorid(int indicatorid) {
		this.indicatorid = indicatorid;
	}

	public String getTerminalid() {
		return terminalid;
	}

	public void setTerminalid(String terminalid) {
		this.terminalid = terminalid;
	}

	public int getSinglecomm() {
		return singlecomm;
	}

	public void setSinglecomm(int singlecomm) {
		this.singlecomm = singlecomm;
	}

	public int getMulticomm() {
		return multicomm;
	}

	public void setMulticomm(int multicomm) {
		this.multicomm = multicomm;
	}

	public int getNetwork() {
		return network;
	}

	public void setNetwork(int network) {
		this.network = network;
	}

	public Indicator getIndicator() {
		return indicator;
	}

	public void setIndicator(Indicator indicator) {
		this.indicator = indicator;
	}

	public String getTime() {
		return time;
	}

	public void setTime(String time) {
		this.time = time;
	}

	/**
	 * 指示器排序
	 * @author Administrator
	 *
	 */
	public class ComparatorIndicator implements Comparator<IndicatorStatus> {

		public int compare(IndicatorStatus arg0, IndicatorStatus arg1) {

			String groupNo0 = arg0.getIndicator().getGroupno() + "";
			String groupNo1 = arg1.getIndicator().getGroupno() + "";
			
			int flag = groupNo0.compareTo(groupNo1);
			if (0 == flag) {
				return arg0.getIndicator().getPhase()
						.compareTo(arg1.getIndicator().getPhase());
			} else {
				return flag;
			}
		}
	}
}
